package com.fj.netty.embed;

import com.fj.netty.chat.message.LoginRequestMessage;
import com.fj.netty.chat.protocol.MessageCodec;
import com.fj.netty.chat.serializer.SerializeConfig;
import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;

/**
 * @author fj
 * @date 2024/1/16 17:49
 */
public class TestChat {
    public static void main(String[] args) {
        LoggingHandler loggingHandler = new LoggingHandler(LogLevel.DEBUG);
        EmbeddedChannel embeddedChannel = new EmbeddedChannel(loggingHandler,new MessageCodec(),loggingHandler);
        LoginRequestMessage message = new LoginRequestMessage("zhangsan","123");
//        byte[] serialize = SerializeConfig.getSerializer().serialize(message);
//        System.out.println(serialize.length);
        embeddedChannel.writeOutbound(message);
//        embeddedChannel.writeInbound(serialize);
    }
}
